<?php
//$str = 'a3b2cd1';
////$pattern = '/\d/'; // 匹配字符串是否有数字
////$pattern = '/[0-9]/';//
//$pattern = '/\w/';
////$result = preg_match($pattern, $str, $match);
//$result = preg_match_all($pattern, $str, $matches);
//print_r($result);
//print_r($matches);

//$password = '1a23A456!';
//
//$pattern1 = '/\d/';
//$pattern2 = '/[a-z]/';
//$pattern3 = '/[A-Z]/';
//$pattern4 = '/[!@#$]/';
//
//if (preg_match($pattern1, $password) && preg_match($pattern2, $password) &&
//    preg_match($pattern3, $password) && preg_match($pattern4, $password)) {
//    echo '密码符合规则';
//} else {
//    echo '密码必须包含……';
//}


$mobile = '18101077880';
$pattern = '/^1[0-9]{10}$/'; // ^代表从字符串开始匹配，$代表匹配到字符串结尾
$result = preg_match($pattern, $mobile);
print_r($result);